<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\SoftDeletes;

/**
 * @property int $id 
 * @property int $business_id 
 * @property int $coupon_id 
 * @property int $user_id 
 * @property int $expire_time 
 * @property int $buy_time 
 * @property int $use_time 
 * @property string $value 
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property int $deleted_at
 * @property Coupon $coupon
 */
class CouponStock extends Model
{
    use SoftDeletes;

    public $dateFormat = 'U';

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'coupon_stock';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $guarded = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'business_id' => 'integer', 'coupon_id' => 'integer', 'user_id' => 'integer', 'expire_time' => 'integer', 'buy_time' => 'integer', 'use_time' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'integer'];

    /**
     * 所属折扣券
     *
     * @return \Hyperf\Database\Model\Relations\BelongsTo
     */
    public function coupon()
    {
        return $this->belongsTo(Coupon::class, 'coupon_id');
    }
}